package com.china.milkywayeye.rasberryPi.controller;

import com.china.milkywayeye.rasberryPi.pojo.User;
import com.china.milkywayeye.rasberryPi.service.UserService;
import com.china.milkywayeye.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@RequestMapping("/user")
@RestController
@CrossOrigin
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/register")
    public void register() {

    }

    @PostMapping("/login")
    public SysResult login(@RequestBody User user) {
        Boolean flag = userService.login(user);
        if (flag) {
            return SysResult.success("登录成功");
        } else {
            return SysResult.fail("请检查账号密码后重试");
        }
    }
}
